package code.google.jcontainer.annotation;

import code.google.jcontainer.resolver.AnnotationResolver;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Used to define resolveClass&when for third party annotation.
 * for example, we'd like to resolve the JDK embedded {@link javax.jws.WebMethod} annotation
 * \@Container(
 *        name = "SimpleContainer3",
 *        componentType = SimpleBean.class, // the annotated class want to be managed by this container
 *        awareAnnotations = {
 *                \@AwareAnnotation(
 *                        annotationClass = WebMethod.class,
 *                        resolverClass = WebMethodAnnotationResolver.class,
 *                        when = {Resolve.WHEN.AFTER_CONSTRUCT})
 *        }
 * )
 *
 * Note: if want to define a annotation created by ourselves, use {@link Container#supportAnnotations()} is preferred. 
 *
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface AwareAnnotation {
    /**
     * the annotation want to resolve
     */
    Class<? extends Annotation> annotationClass();

    /**
     * resolver class for resolving the annotation
     */
    Class<? extends AnnotationResolver> resolverClass();

    /**
     * when to resolve
     */
    Resolve.WHEN[] when();
}